<script>
import { h } from 'vue'
export default {
  name: 'XtxBread',
  render ({ $slots }) {
    const slotItems = $slots
      .default()
      .filter(
        ({ type }) => type.name === 'XtxBreadItem' || type.name === 'Transition'
      ) // 捕获插槽

    const rightVnode = h('i', { class: 'iconfont icon-angle-right' }) // 创建箭头标签

    const arr = [] // 返回标签
    slotItems.map((item, index) => {
      arr.push(item)
      if (index !== slotItems.length - 1) arr.push(rightVnode)
    })

    return h('div', { class: 'xtx-bread' }, arr)
  }
}
</script>

<style scoped lang="less">
.xtx-bread {
  display: flex;
  padding: 25px 10px;
  &-item {
    a {
      color: #666;
      transition: all 0.4s;
      &:hover {
        color: @xtxColor;
      }
    }
  }
  i {
    font-size: 12px;
    margin-left: 5px;
    margin-right: 5px;
    line-height: 22px;
  }
}
</style>
